package com.waiting.thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @Description
 * @Author bjweitingting
 * @Date 2019/2/19
 **/
public class CallThread implements Callable {
    @Override
    public Object call() throws Exception {
        return "这是继承Callable接口的的线程";
    }

    public static void main(String[] args) {
        CallThread testThread=new CallThread();
        FutureTask<Object> futureTask=new FutureTask(testThread);
        new Thread(futureTask).start();
        try {
            System.out.println(futureTask.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
